﻿using System.Text;
using System.Net.Mail;
using System.Collections.Generic;

namespace Qu.SeniorProject.Model
{
    public class MailService
    {
        public static bool SendMail(IList<string> recipients, IList<string> ccRecipients, string bccReceipient, string subject, string body)
        {
            MailMessage message = new MailMessage();

            SmtpClient smtpClient = new SmtpClient();



            foreach (var recipient in recipients)
                message.To.Add(new MailAddress(recipient));

            foreach (var recipient in ccRecipients)
                message.CC.Add(new MailAddress(recipient));   

            if (!string.IsNullOrEmpty(bccReceipient))
                message.Bcc.Add(new MailAddress(bccReceipient));

            message.Subject = subject;
            message.Body = body;
            //message.IsBodyHtml = true;

            smtpClient.Send(message);

            return true;
        }
    }
}
